package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.ScenicTicket;
import cn.wolfcode.trip.base.mapper.ScenicTicketMapper;
import cn.wolfcode.trip.base.query.TicketObject;
import cn.wolfcode.trip.base.service.ITicketService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TicketServiceImpl implements ITicketService {

    @Autowired
    private ScenicTicketMapper mapper;

    @Override
    public PageInfo query(TicketObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<ScenicTicket> list = mapper.selectForList(qo);
        return new PageInfo(list);
    }

    @Override
    public ScenicTicket get(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public void save(ScenicTicket t) {
        mapper.insert(t);
    }

    @Override
    public void update(ScenicTicket t) {
        mapper.updateByPrimaryKey(t);
    }

    @Override
    public List<ScenicTicket> listAll() {
        return null;
    }
}
